<?

class CSession
{
	var $domain	= "";
	var $path	= "/";
	
	function Set($id, $password, $remember)
	{
		$t = $remember  ? ((1<<31) - 1) : 0;
		setcookie("ses_account_id",		$id,		$t, $this->path, $this->domain);
		setcookie("ses_login_password",	$password,	$t, $this->path, $this->domain);
	}
	
	function Clear()
	{
		$t = time() - 3600;
		setcookie("ses_account_id",		"",	$t, $this->path, $this->domain);
		setcookie("ses_login_password",	"",	$t, $this->path, $this->domain);
	}
	
	function IsActive()
	{
		global $ses_account_id;
		return isset($ses_account_id) && $ses_account_id > 0;
	}
	
	function IsNewBrowserSession()
	{
		global $ses_is_logged;
		if (isset($ses_is_logged)) return false;
		
		@setcookie("ses_is_logged", 1, 0, $this->path, $this->domain);
		return true;
	}
	
}

$g_session = new CSession();

?>